package zabbix

import (
	"encoding/json"
	"errors"
)

func GraphitemGetData() (string,map[string]interface{}) {
	method := "graphitem.get"
	var data map[string]interface{}
	jsonstr := []byte(`{
        "output": "extend",
        "graphids": "387"
	}`)
	json.Unmarshal(jsonstr,&data)
	return method,data
}

func GraphitemGet(url string,user string,password string) (interface{},*API) {
	api := LoginAndHandle(url,user,password)
	method,data := GraphitemGetData()
	result,err:=api.ZabbixRequest(method,data)
	if err != nil {
		return nil,api
	}
	if result.Error.Code != 0 {
		err = errors.New(result.Error.Message)
		return nil,api
	}
	resultdata := result.Result
	return resultdata,api
}



